package com.anytron.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.anytron.base.service.impl.BaseServiceImpl;
import com.anytron.mapper.AppNodeMapper;
import com.anytron.model.AppNode;
import com.anytron.model.req.PageRequest;
import com.anytron.model.res.AppNodePOJO;
import com.anytron.service.AppNodeService;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;

@Service
public class AppNodeServiceImpl extends BaseServiceImpl<AppNode> implements AppNodeService {

	AppNodeMapper appNodeMapper;

	@Autowired
	public void setMapper(AppNodeMapper mapper) {
		this.mapper = mapper;
		this.appNodeMapper = mapper;
	}

	@Override
	public PageInfo<AppNodePOJO> selectAllAppNodeInfoByPage(PageRequest pageRequest, AppNode appNode) {
		Page<AppNodePOJO> startPage = PageHelper.startPage(pageRequest.getPageNum(), pageRequest.getPageSize());
		appNodeMapper.selectAllAppNodeInfo(appNode);
		return startPage.toPageInfo();
	}

	@Override
	public List<AppNodePOJO> selectAllAppNodeInfo(AppNode appNode) {
		return appNodeMapper.selectAllAppNodeInfo(appNode);
	}
}
